import { createApp } from "vue";
import App from "./App.vue";
import "./registerServiceWorker";
import router from "./router";
import store from "./store";

import "@/router/route";

import http  from "@/utils/servers";
import { storage } from "@/utils/storage";
import  ekLoading  from "@/utils/loading"; 
import  ekMessage  from "@/utils/message"; 
import  ekMessageBox  from "@/utils/messageBox"; 

// 跨浏览器样式统一
import "normalize.css/normalize.css";
// 字体图标
import "@assets/font/iconfont.css";
// 格式化，通用样式
import "@assets/css/common.css";
// 滚动条样式
import "@assets/css/scrollbar.css";
// 主题
import "@assets/theme/index.css";

// 初始化主题
store.dispatch("theme/initTheme");
// 初始化皮肤
store.dispatch("theme/initSkin");
// 初始化路由
store.dispatch("layout/initRoutes");
// 初始化权限
store.dispatch("permission/initPermission");
// 初始化权维度
store.dispatch("dimension/initDimension");
// 初始化模块
store.dispatch("layout/init");

// 初始化主题
store.dispatch("permission/initUserInfo");

// ElementPlus UI
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhcn from 'element-plus/dist/locale/zh-cn'


const app = createApp(App);
app.config.globalProperties.$storage = storage;
app.config.globalProperties.$http = http;
app.config.globalProperties.$ekLoading = ekLoading;
app.config.globalProperties.$ekMessage = ekMessage;
app.config.globalProperties.$ekMessageBox = ekMessageBox;
app.config.globalProperties.$imageBaseUrl = 'https://uploads-1363744962.cos.ap-guangzhou.myqcloud.com/';
// app.config.globalProperties.$uploadUrl = 'https://app.qinglanguoji.cn/business/upload/upload';
app.config.globalProperties.$uploadUrl =  process.env.UPLOAD_URL+'business/upload/upload';
app.use(store).use(router).use(ElementPlus, {locale: zhcn}).mount("#app");
